package com.yjs.houtai.service.serviceImpl;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.yjs.houtai.entity.Customer;
import com.yjs.houtai.mapper.CustomerMapper;
import com.yjs.houtai.service.CustomerService;
import com.yjs.houtai.entity.Message;

@Service
public class CustomerServiceImpl implements CustomerService {

    @Resource
    private CustomerMapper customerMapper;


    @Override
    public Message deleteByPrimaryKey(Integer customerId) {
        return customerMapper.deleteByPrimaryKey(customerId)==1?Message.success(null):Message.fail(null);
    }

    @Override
    public Message insert(Customer customer) {
        return null;
    }

    @Override
    public Message insertSelective(Customer customer) {

        return customerMapper.insertSelective(customer)==1?Message.success(null).add(customerMapper.selectByPrimaryKey(customer.getcustomerId())):Message.fail(null);
    }

    @Override
    public Message selectByPrimaryKey(Integer customerId) {
        return customerMapper.selectByPrimaryKey(customerId)!=null?Message.success(null).add(customerMapper.selectByPrimaryKey(customerId)):Message.fail(null);
    }

    @Override
    public Message updateByPrimaryKeySelective(Customer customer) {
        return customerMapper.updateByPrimaryKeySelective(customer)==1?Message.success(null).add(customerMapper.selectByPrimaryKey(customer.getcustomerId())):Message.fail(null);
    }

    @Override
    public Message updateByPrimaryKey(Customer customer) {
        return null;
    }

    @Override
    public Message selectAll() {
        return Message.success(null).add(customerMapper.selectAll());
    }

}

